local config = { released = false, buildTime = "2025-09-23 14:00" }

local debugMode = not config.released

config.TestCase = {
    sampleData = { enabled = true and debugMode, intervalMs = 16 }
}

config.Log = { enabled = true } -- and debugMode

local IsProject_SQ = Project == "SQ"
local IsProject_SSQK = Project == "SSQK"
local IsEnv_Android = IsAndroidSys == true

config.Version = { code = 100001, cachePath = "res3D/asset/cache/version" }

if IsEnv_Android then
    config.Version.cachePath = "/sdcard/res3D/cache/version"
end

config.Mechanism = {
    expire = { updateCnt = 2, frameCnt = 15 } -- maxExpireMs = frameCnt x 16.7
}

config.View3D = {
    size = {1068, 720},
    skylineFromTopPx = 136,
    fadeOffsetPx = { horizon = 90, skyline = 23 },
    bgImgPath = { light = "res3D/asset/image/bg.jpg", dark = "res3D/asset/image/bg.jpg" },
    zhicheCachePath = { png = "res3D/asset/cache/zhiche.png", info = "res3D/asset/cache/zhiche" },
    zhichePngOccupation = { wRate = 0.25, hRate = 0.5 }
}

if IsProject_SQ then
    config.View3D.size = {512, 600}
    config.View3D.skylineFromTopPx = 192
    config.View3D.fadeOffsetPx = { horizon = 10, skyline = 10 }
    config.View3D.bgImgPath.light = "res3D/asset/image/bg_android_light.jpg"
    config.View3D.bgImgPath.dark = "res3D/asset/image/bg_android_dark.jpg"
elseif IsProject_SSQK then
    config.View3D.size = {1920, 1080}
    config.View3D.skylineFromTopPx = 257
    config.View3D.fadeOffsetPx = { horizon = 90, skyline = 23 }
    config.View3D.bgImgPath.light = "res3D/asset/image/bg_ssqk.jpg"
    config.View3D.bgImgPath.dark = "res3D/asset/image/bg_ssqk.jpg"
end
if IsEnv_Android then
    config.View3D.zhicheCachePath.png = "/sdcard/res3D/cache/zhiche.png"
    config.View3D.zhicheCachePath.info = "/sdcard/res3D/cache/zhiche"
end

config.Render = {
    clearColor = "transparent",
    surface = { samples = 1, SSAA = 2.0 }
}

if IsProject_SQ or IsProject_SSQK then
    config.Render.surface.samples = 4
    config.Render.surface.SSAA = 1.0
end

config.Camera = {
    viewScale = 1.0,
    position = {0.0, 9.5, 15.1},
    pitchAngle = -18.4,
    fov = 37.0,
    yawAngle = 0.0,
    nearFarPlane = {0.1, 1000.0}
}

if IsProject_SQ then
    config.Camera.viewScale = 0.5
    config.Camera.position = {0.0, 5.6, 14.3}
    config.Camera.pitchAngle = -12.1
    config.Camera.fov = 41.5
elseif IsProject_SSQK then
    config.Camera.viewScale = 0.4
    config.Camera.position = {0.0, 1.0, -2.2}
    config.Camera.pitchAngle = -90.0
end

config.Light = {
    Directional = {
        worldDirection = {0.0, -1.0, -1.2},
        intensity = 10.0,
        color = "white"
    },
    Point = {
        position = {1.0, -10.0, 21.0},
        intensity = 3.5,
        constAtt = 1.0,
        linearAtt = 0.01,
        quadAtt = 0.01,
        color = "white"
    }
}

config.PbrMaterial = {
    forceUseCfgValue = true,
    baseColor = "white",
    metallic = 0.0,
    roughness = 1.0,
    pbrGlobalAmbientCompnt = 0.2
}

if IsProject_SQ or IsProject_SSQK then
    config.PbrMaterial.pbrGlobalAmbientCompnt = 1.0
end

config.Shader = {
    dir = "res3D/asset/glsl",
    line = "line%1",
    modelPBR = "modelPBR%1",
    anyFree = "anyFree%1",
    anyFreeAlpha = "anyFreeAlpha%1",
    accFD = "accFD%1",
    accTG = "accTG%1",
    lampLight = "lampLight%1",
    lineEllipse = "lineEllipse%1",
    dclcArrow = "dclcArrow%1",
    roadDotBg = "roadDotBg%1",
    laneBg = "laneBg%1",
    roadEdge = "roadEdge%1",
    sceneTexture = "sceneTexture%1",
    activeCircle = "activeCircle%1",
    modelTexture = "modelTexture%1"
}

if IsProject_SQ or IsProject_SSQK then
    config.Shader.dclcArrow = "dclcArrow_android%1"
end

local Line_width = 0.1
local Line_dashedSegLen = 6.0
local Line_pointsZStep = 0.45

config.Line = {
    cutOff = { enableEqStart = false, enableEqEnd = true },
    fadeByEndZOffsetPx = 15,
    width = Line_width,
    defColor = "white",
    defGrey = "#c0c0c0",
    pointsZStep = Line_pointsZStep,
    hInterval = Line_width * 0.4,
    vSpeedFactor = Line_dashedSegLen / 30.0,
    dashed = { segLen = Line_dashedSegLen, segInterval = Line_dashedSegLen * 1.0 },
    roadEdge = { --style:dashed
        segLen = 0.8,
        segInterval = Line_pointsZStep * 0.1,
        size = { Line_width * 1.0, Line_width * 2.0 },
        upColor = "#bbbbbb",
        sideColor = "#666666"
    }
}

if IsProject_SQ or IsProject_SSQK then
    config.Line.cutOff.enableEqStart = true
    config.Line.fadeByEndZOffsetPx = 60
    config.Line.defGrey = "#d6d6d6"
    config.Line.roadEdge = { --style:continuous
        size = { Line_width * 3.0, Line_width * 5.0 },
        upColor = "white",
        sideColor = "#dddddd"
    }
    if IsProject_SSQK then
        config.Line.hInterval = Line_width * 1.0
        config.Line.dashed.segLen = Line_dashedSegLen * 0.5
        config.Line.dashed.segInterval = Line_dashedSegLen * 0.5
    end
end

config.Model = {
    scale = 1.0,
    dir = "res3D/asset/object",
    zhiche = "zhiche.glb",
    car = "car.glb",
    bus = "bus.glb",
    truck = "truck.glb",
    moto = "moto.glb",
    bike = "bike.glb",
    cone = "cone.glb",
    person = "person.glb",
    barrier = "barrier.glb",
    undefined = "undefined.glb"
}

if IsProject_SQ or IsProject_SSQK then
    config.Model.zhiche = "zhiche_android.glb"
    if IsProject_SSQK then
        config.Model.scale = 0.03
    end
end

config.Marker = {
    accFD = {
        frontOffsetD = 0.3,
        topWByFrontWTimes = 0.8,
        bottomWByFrontWTimes = 1.5,
        hByFrontWTimes = 2.0
    },
    accTG = {
        zhicheHeadOffsetD = 7.0,
        wByZhicheWTimes = 0.8,
        rectHByZhicheWTimes = 0.4,
        rectIntervalByZhicheWTimes = 0.4,
        color = "#236dfb"
    },
    lamp = {
        lightRadiusByModelWTimes = 0.25,
        turnColor = "#ffff3f",
        brakeColor = "#ff3f3f"
    },
    ellipse = {
        centerZ = -10.0,
        hAxis = 5.0,
        vAxis = 40.0,
        colorNormal = "#0568FC",
        colorWarning = "#FA0001",
        blinkFrameGap = 10
    },
    dclcArrow = {
        zStart = -5.0,
        zRectEnd = -10.0,
        zBezierEnd = -18.0,
        zEndBelowSkyline = 30.0,
        rectWByZhicheWTimes = 0.8,
        offsetWPercentage = 0.28,
        edgeW = 0.1,
        color = "#4CEA7D73"
    },
    roadBg = {
        dotRadius = 0.04,
        dotInterval = { h = 0.5, v = 1.5 },
        color = { light = "#51565c", dark = "#51565c" }
    },
    activeCircle = { breathFrameGap = 50, radius = 2.3 }
}

if IsProject_SQ or IsProject_SSQK then
    config.Marker.dclcArrow = {
        zStart = 0.5,
        zRectEnd = -10.0,
        zBezierEnd = -18.0,
        zEndBelowSkyline = 1.0,
        rectWByZhicheWTimes = 0.4,
        offsetWPercentage = 0.28,
        edgeW = 0.1,
        color = "#269CFF73"
    }
    config.Marker.roadBg = {
        zStep = Line_pointsZStep,
        color = { light = "#566B80", dark = "#414247" }
    }
end

config.Y = {
    roadBg = 0.0,
    line = 0.01,
    activeCircle = 0.015,
    model = 0.02,
    ellipse = 0.03,
    dclcArrow = 0.04,
    accFD = 0.05,
    accTG = 0.06
}

return config
